package fr.uha.ensisa.jmp.drone.tests;

import fr.uha.ensisa.jmp.drone.at_commands.AtAnimCommand;
import fr.uha.ensisa.jmp.drone.at_commands.AtCommands;
import fr.uha.ensisa.jmp.drone.at_commands.AtConfigCommand;
import fr.uha.ensisa.jmp.drone.at_commands.AtFtrimCommand;
import fr.uha.ensisa.jmp.drone.at_commands.AtMTrimCommand;
import fr.uha.ensisa.jmp.drone.at_commands.AtPcmCommand;
import fr.uha.ensisa.jmp.drone.at_commands.AtRefCommand;
import fr.uha.ensisa.jmp.drone.at_commands.AtZapCommand;
import fr.uha.ensisa.jmp.drone.at_commands.AtAnimCommand.AnimType;
import fr.uha.ensisa.jmp.drone.at_commands.AtZapCommand.ZapVideoChannel;

public class Tests
{
	public static void testCommands()
	{
		System.out.println("test AtRefCommand");
		AtRefCommand cref1 = new AtRefCommand();
		cref1.sequenceNbr(1);
		cref1.param(0);
		assert(cref1.toString().equals("AT*REF=1,0\r"));
		cref1.param(256);
		assert(cref1.toString().equals("AT*REF=1,256\r"));
		cref1.sequenceNbr(2);
		assert(cref1.toString().equals("AT*REF=2,256\r"));
		
/*		System.out.println("test Delegates");
		AtCommands.land().sequenceNbr(1);
		assert(AtCommands.land().toString().equals("AT*REF=1,290717696\r"));
		AtCommands.takeoff().sequenceNbr(1);
		assert(AtCommands.takeoff().toString().equals("AT*REF=1,290718208\r"));
*/		
		System.out.println("test AtPcmdCommand");
		AtPcmCommand cpcmd1 = new AtPcmCommand();
		cpcmd1.sequenceNbr(1);
		cpcmd1.param(true, 0.1f, -0.1f,0f, 0f);
		assert(cpcmd1.toString().equals("AT*PCMD=1,1,1036831949,-1110651699,0,0\r"));
		cpcmd1.param(false, 0.1f, -0.1f,0f, 0f);
		assert(cpcmd1.toString().equals("AT*PCMD=1,0,1036831949,-1110651699,0,0\r"));
		cpcmd1.sequenceNbr(2);
		assert(cpcmd1.toString().equals("AT*PCMD=2,0,1036831949,-1110651699,0,0\r"));
		
		System.out.println("test AtFTrimCommand");
		AtFtrimCommand cftrim1 = new AtFtrimCommand();
		cftrim1.sequenceNbr(1);
		assert(cftrim1.toString().equals("AT*FTRIM=1\r"));
	
		System.out.println("test AtMTrimCommand");
		AtMTrimCommand cmftrim1 = new AtMTrimCommand();
		cmftrim1.sequenceNbr(1);
		cmftrim1.param(0.1f,-0.1f,0);
		assert(cmftrim1.toString().equals("AT*MTRIM=1,1036831949,-1110651699,0\r"));
		
		System.out.println("test AtZapCommand");
		AtZapCommand czap1 = new AtZapCommand();
		czap1.sequenceNbr(1);
		czap1.param(ZapVideoChannel.ZAP_CHANNEL_VERT);
		assert(czap1.toString().equals("AT*ZAP=1,1\r"));

		System.out.println("test AtConfigCommand");
		AtConfigCommand cconf1 = new AtConfigCommand();
		cconf1.sequenceNbr(1);
		cconf1.param("CONTROL:altitude_max","3000");
		assert(cconf1.toString().equals("AT*CONFIG=1,\"CONTROL:altitude_max\",\"3000\"\r"));
		
		System.out.println("test AtAnimCommand");
		AtAnimCommand canim1 = new AtAnimCommand();
		canim1.sequenceNbr(1);
		canim1.param(AnimType.ANIM_THETA_M30_DEG, 60);
		System.out.println(canim1);
		assert(canim1.toString().equals("AT*ANIM=1,2,60\r"));
		
		AtCommands.ACK_CONTROL_MODE_CDE.sequenceNbr(10);
		System.out.println(AtCommands.ACK_CONTROL_MODE_CDE);

	}
	
		
	public static void main(String[] args)
	{
		//short n= (short) 0xFFFF;
		//System.out.println(n);
	      System.out.println( "(" + 5 + " cows" + ')' );

		//testCommands();
		//testDrone();
	}
}
